package com.edu.dgut.dao;

import com.edu.dgut.entity.goodsEntity;
import org.springframework.data.jpa.repository.JpaRepository;

import javax.transaction.Transactional;
import java.util.List;

public interface goodsRepository extends JpaRepository<goodsEntity,String> {

    //通过商品id查询商品信息
    List<goodsEntity> findByGoodsId(int goods_id);

    //通过商品名查找商品信息
    List<goodsEntity> findByGoodsNameLike(String goods_name);

    //插入或修改商品信息
    goodsEntity save(goodsEntity goods);

    //通过商品id删除一条订单信息
    @Transactional
    int deleteByGoodsId(int goods_id);
}
